package com.drdj.exam;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class NewActivityForResult extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.new_activity_for_result);

		/*
		 * finish activity with result.
		 */
		((Button) findViewById(R.id.btnFinishWithResult)).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String resultData = ((EditText) findViewById(R.id.etResultData)).getText().toString();

				Intent intent = getIntent();
				intent.putExtra("result_data", resultData);
				setResult(RESULT_OK, intent);
				finish();
			}
		});
	}
}
